<!--
/**************************************************
* @(#)organizationmodify.jsp
*
* Copyright (c) 2005 Hitrust Technology Inc.
* Developed by SDC, Hitrust.
* All Rights Reserved.
*
* Modify History:
*  v1.00, 2005/2/14, owen xia
*  1) first release
   2) add javascript method changelist2,implemnt select jump
/**************************************************
-->
<%@ page contentType="text/html; charset=UTF-8"%>
<html>
<head>
<title>修改组织机构</title>
<%@ include file="../common.jsp"%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="css/caigouxitong.css" rel="stylesheet" type="text/css">
<SCRIPT language="JavaScript" src="<%=root%>/js/common.js"></SCRIPT>
<SCRIPT language="JavaScript" src="<%=root%>/js/hi-check.js"></SCRIPT>
<%

if(message == null){
%>
<script>
   //返回
   function back(){
    //checkform.action='<%= response.encodeURL(request.getContextPath() + "/A400401.do") %>';
    //checkform.submit();
     self.close();
   }
 
		
  	function check(){ 
  	   
	    var iFields1 = new Array(11);
        iFields1[0] = 'gs_org_id||机构编号||Y||4||#0';
        iFields1[1] = 'gs_org_name||机构名称||Y||1-50||##';
        iFields1[2] = 'gs_upper_orgId||上级组织机构编号||Y||4||#0';
        iFields1[3] = 'gs_org_addr||机构地址||N||1-50||##';
        iFields1[4] = 'gs_org_post||机构邮编||N||1-20||#0';
        iFields1[5] = 'gs_org_phone||机构电话||N||1-50||#A';
        iFields1[6] = 'gs_org_fax||机构传真||N||1-50||#A';
        iFields1[7] = 'gs_principal_name||负责人姓名||N||1-50||##';
        iFields1[8] = 'gs_principal_phone||负责人电话||N||1-50||#A';
        iFields1[9] = 'gs_principal_email||负责人电子邮件||N||1-50||#M';
        iFields1[10] = 'gs_is_stock||是否为订货单位||N||1-20||##';
        
        if( HiScript.value(checkform.name,iFields1) == false)  return false;
	    
	    var orgid1=document.checkform.gs_org_id.value.substring(0,2);
	    var orgid2=document.checkform.gs_org_id.value.substring(2,4);
	    var upper1=document.checkform.gs_upper_orgId.value;
	    var upper2=document.checkform.gs_upper_orgId.value.substring(0,2);
	    
	    //alert(orgid1);
	    //判断上级组织机构编号是否有效
	    if(orgid1=="00"||orgid2=="00"){
	     if(!((orgid1=="00"||orgid2=="00")&&upper1=="0000")){
	        alert("该上级组织机构必须是0000！");
	        return false;
            }
           // }
	    }
	    else{
	      //alert(upper2);
	      if(upper2=="00"){
	         alert("该上级组织机构必须是XX00！");
	         return false;
	      }
	    }
	    
	    //checkform.action="<%= response.encodeURL(request.getContextPath() + "/A400406.do") %>";   
		//document.checkform.submit();
		//window.returnValue = '1';
		//window.close();
		
		 var ary = new Array(11);
            ary[0] = checkform.gs_org_id.value;
            ary[1] = checkform.gs_org_name.value;
            ary[2] = checkform.gs_org_addr.value;
            ary[3] = checkform.gs_org_post.value;
            ary[4] = checkform.gs_org_phone.value;
            ary[5] = checkform.gs_org_fax.value;
            ary[6] = checkform.gs_principal_name.value;
            ary[7] = checkform.gs_principal_phone.value;
            ary[8] = checkform.gs_principal_email.value;
            ary[9] = checkform.gs_upper_orgId.value;
            ary[10] = checkform.gs_is_stock.value;
			window.returnValue = ary;
			window.close();
	}
		
		</script>
</head>
<body BGCOLOR="#f2f2f2" text="#000000" leftmargin="0" topmargin="0"  marginwidth="0" marginheight="0">
<p><br>
</p>
<table width="90%" border="0" cellspacing="0" cellpadding="0" align="center">
	<tr>
		<td height="20">
		<table width="100%" border="0" cellspacing="0" cellpadding="1">
			<tr height="20">
				<td height="20" width="1" class="mtxt_black">&nbsp;</td>
				<td height="30" width="758" class="mtxt_black">修改组织机构</td>
			</tr>
		</table>
		</td>
	</tr>
	<tr>
		<td class="bg_line" height="2"></td>
	</tr>
</table>

<br>
<%GSOrganizationBean tGSOrganizationBean = (GSOrganizationBean)request.getAttribute("organizationBean");
 %>
<!--组织机构信息--------------------------------------------------------------------------------------------------------------------------->
<form name="checkform" action="" method="post">



<table width="90%" border="0" cellspacing="0" cellpadding="0"
	align="center">
	<tr>
		<td>
		<table class=bg_table id=tableId cellspacing=1 cellpadding=0
			style="padding-left:5;padding-right:5" width=100% align=center
			border=0>
			<TR class="bg_column" height=20>
				<TD colspan="4">修改组织机构信息</TD>
			</TR>
			<TR class="bg_row_odd" height=20>
				<TD align=right width="20%">机构编号</TD>
				<TD align=left width="30%">
				<input type="hidden" name="gs_org_id" value="<%=tGSOrganizationBean.getGs_org_id()%>">
				<%=tGSOrganizationBean.getGs_org_id() %>
				</TD>
				<TD align=right width="20%">机构名称</TD>
				<TD align=left width="30%">
				<input type=text name="gs_org_name" maxlength="50" size=30 value="<%=tGSOrganizationBean.getGs_org_name() %>"/>
				<font color='red'>&nbsp;*</font>
			    </TD>
			</TR>
			<TR class="bg_row_odd" height=20>
				<TD align=right>机构地址</TD>
				<TD align=left>
				<input type=text name="gs_org_addr" maxlength="50" size=30 value="<%=tGSOrganizationBean.getGs_org_addr() %>"/>
				</TD>
				<TD align=right>机构邮编</TD>
				<TD align=left>
				<input type=text name="gs_org_post" maxlength="50" size=30 value="<%=tGSOrganizationBean.getGs_org_post() %>"/>
				</TD>
			</TR>
			<TR class="bg_row_odd" height=20>
				<TD align=right>机构电话</TD>
				<TD align=left>
				<input type=text name="gs_org_phone" maxlength="50" size=30 value="<%=tGSOrganizationBean.getGs_org_phone() %>"/>
				</TD>
				<TD align=right>机构传真</TD>
				<TD align=left>
				<input type=text name="gs_org_fax" maxlength="50" size=30 value="<%=tGSOrganizationBean.getGs_org_fax() %>"/>
				</TD>
			</TR>
			<TR class="bg_row_odd" height=20>
				<TD align=right>负责人姓名</TD>
				<TD align=left>
				<input type=text name="gs_principal_name" maxlength="50" size=30 value="<%=tGSOrganizationBean.getGs_principal_name() %>"/>
				</TD>
				<TD align=right>负责人电话</TD>
				<TD align=left>
				<input type=text name="gs_principal_phone" maxlength="50" size=30 value="<%=tGSOrganizationBean.getGs_principal_phone() %>"/>
				</TD>
		    </TR>
		    <TR class="bg_row_odd" height=20>
				<TD align=right >负责人电子邮件</TD>
				<TD align=left>
				<input type=text name="gs_principal_email" maxlength="50" size=30 value="<%=tGSOrganizationBean.getGs_principal_email() %>"/>
				</TD>
				<TD align=right >上级组织机构编号</TD>
				<TD align=left>
			
				 <select name="gs_upper_orgId" size="1">
		     <%//获取所有机构代码
			 ArrayList tList = (ArrayList) request.getAttribute("Oraganization");
		     GSOrganizationBean tOrganization = null;
			 if (tList != null) {
				for (int n = 0; n < tList.size(); n++) {
				    tOrganization = (GSOrganizationBean) tList.get(n);
                    if(tOrganization.getGs_org_id().equals(tGSOrganizationBean.getGs_upper_orgId())){
					%>
					<option value="<%=tOrganization.getGs_org_id()%>" selected>
					  <%=tOrganization.getGs_org_name()%>|<%=tOrganization.getGs_org_id() %>
					</option>
                     <%}else{ %>
					<option value="<%=tOrganization.getGs_org_id() %>">
						<%=tOrganization.getGs_org_name()%>|<%=tOrganization.getGs_org_id() %>
					</option>
					<%}
				}
			}
			%>
				</select>
				</TD>
			</TR>
			<TR class="bg_row_odd" height=20>
			    <TD align=right >是否为订货单位</TD>
				<TD align=left>
				  <select name="gs_is_stock" size="1">
				   <% String isStock = tGSOrganizationBean.getGs_is_stock();
				      if (isStock == null) {isStock = "0";}
				      isStock = isStock.trim();
				   %>
				    <option value="1" <%=(isStock.equals("1")?"selected":"")%>>_是_</option>
					<option value="0" <%=(isStock.equals("0")?"selected":"")%>>_否_</option>
				  </select>
				</TD>
				<td>&nbsp; </td>
				<td>&nbsp;</td>
			</TR>	
		
		</TABLE>
		</td>
	</tr>
	
</table>

</form>

<!----------------------------------------------------------------------------------------------------------------------------------->
<p align="center">
<input type="button" class="kuang" value='修改' onclick="return check();"> 
<input type="button" class="kuang" value='关闭' onclick="return back();"></p>
<p>
<p>
<p>
<p><br>
<br>
<br>
<br>
<br>

</body>
<%} %>
</html>
